package day11.byteStream;

import java.io.*;

/**
 * @author Xiao
 * @date 2021/8/1
 */
public class BisDemo01 {
    /**
     * 	字节缓冲输出流: BufferedOutputStream(OutputStream out)
     * 	字节缓冲输入流: BufferedInputStream(InputStream in)
     */
    public static void main(String[] args) throws IOException {
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(
                "videoPractice\\src\\day11\\byteStream\\bisdemo01.txt"));
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream(
                "E:\\develop\\Test\\aaa.txt"));
//        mothod1(bos, bis);
        byte[] bytes = new byte[1024];
        int len;
        while ((len = bis.read(bytes)) != -1) {
            bos.write(bytes,0,len);
        }
        bis.close();
        bos.close();
    }

    private static void mothod1(BufferedOutputStream bos, BufferedInputStream bis) throws IOException {
        int read;
        if ((read = bis.read()) != -1) {
            bos.write(read);
        }
    }
}
